/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem;

import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.CenterOfMassPosition;
import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.CenterOfMassPositionImpl;
import it.free.i.virtual.machine.hal.devicealias.echo.CollisionEcho;
import it.free.i.virtual.machine.hal.devicealias.echo.CollisionEchoImpl;
import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.LinearVelocity;
import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.LinearVelocityImpl;
import it.free.i.virtual.machine.hal.devicealias.echo.PositionEcho;
import it.free.i.virtual.machine.hal.devicealias.echo.PositionEchoImpl;

/**  
 * Domain specific objects' factory
 * @author stefano
 */
public class PositioningSystemDomainObjectFactory {

	public static final PositionEcho buildPositionEcho(float centerOfMassX,
													   float centerOfMassY,
													   float centerOfMassZ,
													   float linearVelocityX,
													   float linearVelocityY,
													   float linearVelocityZ){
		
		CenterOfMassPosition centerOfMassPosition = new CenterOfMassPositionImpl();
		
		centerOfMassPosition.setX(centerOfMassX);
		centerOfMassPosition.setY(centerOfMassY);
		centerOfMassPosition.setZ(centerOfMassZ);
		
		LinearVelocity linearVelocity = new LinearVelocityImpl();
		
		linearVelocity.setX(linearVelocityX);
		linearVelocity.setY(linearVelocityY);
		linearVelocity.setZ(linearVelocityZ);
		
		PositionEcho positionEcho = new PositionEchoImpl();
		
		positionEcho.setCenterOfMassPosition(centerOfMassPosition);
		positionEcho.setLinearVelocity(linearVelocity);
		
		return positionEcho;
	}
	
	/**
	 * Build a collision object from simple data
	 * @param collidedObjectCenterOfMassX is the collided object center of mass, x coordinate
	 * @param collidedObjectCenterOfMassY is the collided object center of mass, y coordinate
	 * @param collidedObjectCenterOfMassZ is the collided object center of mass, z coordinate
	 * @param collidedObjectShapeName is the name of the shape the system collided with
	 * @return a collision dto
	 */
	public static final CollisionEcho buildCollision(float collidedObjectCenterOfMassX, 
							 					 float collidedObjectCenterOfMassY, 
							 					 float collidedObjectCenterOfMassZ, 
							 					 String collidedObjectShapeName){
		
		CollisionEcho collisionEcho = new CollisionEchoImpl();
		
		CenterOfMassPosition centerOfMassPosition = new CenterOfMassPositionImpl();
		centerOfMassPosition.setX(collidedObjectCenterOfMassX);
		centerOfMassPosition.setY(collidedObjectCenterOfMassY);
		centerOfMassPosition.setZ(collidedObjectCenterOfMassZ);
		
		collisionEcho.setCenterOfMassPosition(centerOfMassPosition);
		collisionEcho.setImpactedObjectDescription(collidedObjectShapeName);
		
		return collisionEcho;
	}
	
}
